<?exit?>
<table width="100%" cellspacing="0" cellpadding="0" border="0" id="pagehead" summary="">
	<tbody>
		<tr>
			<td><h1>积分规则</h1></td>
		</tr>
	</tbody>
</table>

<div class="colorarea01">
	<table cellspacing="2" cellpadding="2" class="helptable">
		<tbody>
			<tr><td>
			<ul><li>1、用户通过积分规则赚取积分。</li>
				<li>2、还可以通过UCenter设置积分兑换比率(UCenter => <a href="{UC_API}/admin.php?m=credit&a=ls" target="_blank">积分兑换</a>)，让用户把赚取到的积分兑换成UCenter Home或者论坛的积分。</li>
				<li>3、奖励：加积分加经验；消费：减积分加经验；惩罚：减积分减经验；</li></ul>
			</td></tr>
		</tbody>
	</table>
</div>

<!--{eval $_TPL['rewardtype'] = array('0' => '扣分','1' => '加分','2' => '惩罚');
			$_TPL['cycletype'] = array('0' => '一次性','1' => '每天','2' => '整点','3' => '间隔分钟','4' => '不限周期');}-->

<!--{if $_GET[op]=='edit'}-->
	<form method="post" action="admincp.php?action=credit">
		<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
		<div class="title"><h3>规则设置</h3></div>
		<table cellspacing="0" cellpadding="0" class="formtable">
			<tr><th style="width:10em;">规则名称</th>
				<td><input type="text" value="$rule[rulename]" name="rulename" /></td></tr>
			<tr><td>奖励方式</td>
				<td>$_TPL[rewardtype][$rule[rewardtype]]</td></tr>
			<!--{if $rule[rewardtype] == 1}--> 
			<tbody id="otherrule" >
				<tr><td style="width:10em;">奖励周期</td>
					<td><!--{loop $_TPL[cycletype] $key $desc}-->
						<input type="radio" name="cycletype" value="$key" onclick="showoption($key);" <!--{if $key == $rule[cycletype]}-->checked<!--{/if}-->>$desc 
						<!--{/loop}--></td></tr>
				<tr id="cycletimetr" <!--{if in_array($rule[cycletype], array(0, 1, 4))}--> style="display:none"<!--{/if}-->>
					<td>间隔时间</td>
					<td><input type="text" name="cycletime" value="$rule[cycletime]"></td></tr>
				<tr id="rewardnumtr"<!--{if $rule[cycletype] == 0}--> style="display:none"<!--{/if}-->>
					<td>奖励次数</td>
					<td><input type="text" name="rewardnum" value="$rule[rewardnum]">0为不限次数</td>	</tr>
			</tbody>
			<!--{/if}-->
			<tr><td><!--{if $rule[rewardtype]==1}-->奖励<!--{else}-->扣除<!--{/if}-->积分值</td>
				<td><input type="text" name="credit" value="$rule[credit]"></td></tr>
			<tr><td><!--{if $rule[rewardtype]==2}-->扣除<!--{else}-->奖励<!--{/if}-->经验值</td>
				<td><input type="text" name="experience" value="$rule[experience]"></td></tr>
		</table>
		<br/>
		<input type="submit" name="creditsubmit" value="提交" class="submit">
		<input type="hidden" name="rid" value="$_GET[rid]" />
	</form>
	<script type="text/javascript">
		function showoption(id) {
			switch(id) {
				case 0:
					$('cycletimetr').style.display = "none";
					$('rewardnumtr').style.display = "none";
					break;
				case 1:
				case 4:
					$('cycletimetr').style.display = "none";
					$('rewardnumtr').style.display = "";
					break;
				case 2:
				case 3:
					$('cycletimetr').style.display = "";
					$('rewardnumtr').style.display = "";
					break;
			}
		}
	</script>
<!--{else}-->
	<div id="newslisttab">
		<ul>
			<li>奖励方式</li>
			<li<!--{if $_GET['type'] == 0}--> class="active"<!--{/if}-->><a href="$theurl&type=0">消费</a></li>
			<li<!--{if $_GET['type'] == 1}--> class="active"<!--{/if}-->><a href="$theurl&type=1">奖励</a></li>
			<li<!--{if $_GET['type'] == 2}--> class="active"<!--{/if}-->><a href="$theurl&type=2">惩罚</a></li>
		</ul>
	</div>

	<div class="bdrcontent">
		<table width="100%" cellspacing="0" cellpadding="0" class="formtable">
			<tr>
				<th>动作名称</th>
				<!--{if $_GET[type]=='1'}-->
				<th width="80">奖励周期</th>
				<th width="80">奖励次数</th>
				<!--{/if}-->
				<th width="80">奖励方式</th>
				<th width="80"><!--{if $_GET[type]=='1'}-->奖励积分<!--{else}-->扣除积分<!--{/if}--></th>
				<th width="80"><!--{if $_GET[type]=='2'}-->扣除经验值<!--{else}-->奖励经验值<!--{/if}--></th>
				<th width="50">操作</th>
			</tr>
			<!--{if $list}-->
				<!--{loop $list $value}-->
				<tr>
					<td>$value[rulename]</td>
					<!--{if $_GET[type]=='1'}-->
					<td>$_TPL[cycletype][$value[cycletype]]</td>
					<td><!--{if $value[rewardnum]=='0'}-->不限次数<!--{else}-->$value[rewardnum]<!--{/if}--></td>
					<!--{/if}-->
					<td>$_TPL[rewardtype][$value[rewardtype]]</td>
					<td>$value[credit]</td>
					<td>$value[experience]</td>
					<td><a href="admincp.php?action=credit&op=edit&rid=$value[rid]">编辑</a></td>
				</tr>
				<!--{/loop}-->
			<!--{else}-->
				<tr>
					<td<!--{if $_GET[type]=='1'}--> colspan="6"<!--{else}--> colspan="4"<!--{/if}-->>暂无相关积分规则</td>
				</tr>
			<!--{/if}-->
		</table>
	</div>
<!--{/if}-->



